<%@page import="DAO.DAO_Student"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
            DAO_Student studentDAO = new DAO_Student();
            String paging = request.getParameter("page");
            int pageNo;
            if(paging == null) {
                pageNo = 1;
            }else{
                try{
                    pageNo = Integer.parseInt(paging);
                }catch(NumberFormatException e) {
                    pageNo = 1;
                }
            }
            
            /*Declare variable*/
            int totalItems = studentDAO.getNumberOfStudent();
            int itemsPerPage = 10;
            
            int totalPages = (int) Math.ceil((double)totalItems/itemsPerPage);
            
            if(pageNo <= totalPages) {
                int fro = (pageNo - 1) * 10 + 1;
                int to = fro + (itemsPerPage - 1);
                
            }
            %>
    </body>
</html>
